import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';

/**
 * 字典实体
 */
@Entity('dictionary')
export class Dictionary {
  /**
   * 主键ID
   */
  @PrimaryGeneratedColumn({ type: 'bigint' , unsigned: true,})
  id?: number;

  /**
   * 字典项名称
   */
  @Column({
    type: 'varchar',
    length: 128,
    name: 'name'
  })
  name?: string;

  /**
   * 字典项编码
   */
  @Column({
    type: 'varchar',
    length: 128,
    name: 'code'
  })
  @Index('idx_code')
  code?: string;

  /**
   * 字典项值
   */
  @Column({
    type: 'varchar',
    length: 512,
    name: 'value'
  })
  value?: string;

  /**
   * 字典类型
   */
  @Column({
    type: 'varchar',
    length: 128,
    name: 'type'
  })
  @Index('idx_type')
  type?: string;

  /**
   * 启用状态
   */
  @Column({
    type: 'boolean',
    default: false,
    name: 'enable'
  })
  enable?: boolean;

  /**
   * 创建时间
   */
  @CreateDateColumn({
    type: 'timestamp',
    name: 'create_time'
  })
  createTime?: Date;

  /**
   * 更新时间
   */
  @UpdateDateColumn({
    type: 'timestamp',
    name: 'update_time',
    nullable: true
  })
  updateTime?: Date;
} 